<template>
    <basic-container>
        <avue-crud :data="data"
                   :option="option"
                   :page="page"
                   @refresh-change="refreshChange"
                   @search-change="searchChange"
                   @search-reset="searchReset"
                   @current-change="currentChange"
                   @size-change="sizeChange"
                   @on-load="onLoad"
        >
            <!-- 是否显示插槽 -->
            <template slot-scope="{row}" slot="status">
                <el-switch
                        @change="rowSwitchChange(row)"
                        v-model="row.status"
                        active-value="ENABLE"
                        inactive-value="DISABLE"
                        active-color="#13ce66"
                        inactive-color="#ff4949">
                </el-switch>
            </template>


        </avue-crud>


    </basic-container>
</template>
<script>
    import {
        getList,

    } from "@/api/minmao/mgr/profitDetaile.js";
    var Dict = JSON.parse(localStorage.getItem('mall-dictionary')).content;
    export default {
        data() {
            return {
                editLoad:false,
                addLoad:false,
                // 旧的任务分组
                oldJobName:'',
                oldJobGroup:'',
                query: {},
                page: {
                    pageSize: 10,
                    currentPage: 1,
                    total: 0
                },
                box:false,
                editBox:false,
                formData:{
                    jobGroup:'',
                    jobName:'',
                    cronExpression:'',
                    jobDescription:''
                },

                data:[],
                option:{
                    size: 'mini',
                    editBtn:false,
                    addBtn:false,
                    delBtn:false,
                    height: 'auto',
                    // calcHeight: 380,
                    index: true,
                    page:false,
                    align:'center',
                    menuAlign:'center',
                    menuWidth: 100,
                    searchMenuSpan:6,
                    menu:false,
                    column:[
                        {
                            label: "受益人",
                            prop: "name",

                        },
                        {
                            label: "受益人手机号",
                            prop: "phone",
                        },
                        {
                            label: "交易类型",
                            prop: "tradeType",
                            dicData: Dict.tradeTypeEnum,
                        },
                        {
                            label: "金额",
                            prop: "amount",
                        },
                        {
                            label: "流水状态",
                            prop: "lockStatus",
                            dicData: Dict.lockStatusEnum,
                        },
                        {
                            label: "时间",
                            prop: "addTime",

                        },
                    ]
                },
            };
        },
        watch:{
            box(val){
                if(!val){
                    this.$nextTick(()=>{
                        this.$refs["ruleFormAdd"].resetFields();
                    })
                    this.addLoad=false
                }
            },
            editBox(val){
                if(!val){
                    this.$nextTick(()=>{
                        this.$refs["ruleFormEdit"].resetFields();
                    })
                    this.editLoad=false
                }

            },
        },
        methods: {
            // 点击页数
            currentChange (currentPage) {
                this.page.currentPage = currentPage;
            },
            // 点击页数
            sizeChange (pageSize) {
                this.page.pageSize = pageSize;
            },

            onLoad (page, params = {},done) {//页面初始化请求管理员列表
                getList(page.currentPage,page.pageSize,Object.assign(params, this.query)).then(res=>{
                    if(done){
                        done();
                    }
                    this.data=res.data.data
                    this.page.total=res.data.count
                })
            },
            searchReset () {
                this.query = {};
                this.onLoad(this.page);
            },
            // 搜索框
            searchChange(params,done) {
                this.page.currentPage=1
                this.query = params;
                this.onLoad(this.page, params,done);
            },
            refreshChange({page,searchForm}){
                this.onLoad(this.page);
            }
        }

    }
</script>
<style scoped>
    .bigBox{
        width: 60%;
    }
</style>


